<?php
namespace app\api\home;
use app\api\model\DataModel;
use app\common\controller\Common;

class Index extends Common
{
    public function index($num = 2)
    {
        if ($this->request->isPost()) {
            $data = DataModel::table("hisi_article")->field(["title","avatar"])->limit($num)->select();
            return json_encode(["code" => 1, "message" => "成功", "data" => $data]);
        }
        return $this->fetch();
    }
}